package com.ashapo.example;

public class Example001Variable {

    /**
     * 入口方法，演示基础数据类型
     * @param args 接收参数
     */
    public static void main(String[] args){
        //8位整数,-128至127
        byte smallNumber = 126;
        System.out.println("Small Number =" + smallNumber);

        //16位整数-32,768 (-2^15)至32,767 (2^15 -1)
        short shortNumber = 32000;
        System.out.println("Short Number =" + shortNumber);

        //32位整型
        int firstNumber;
        firstNumber = 10;
        System.out.println("First Number =" + firstNumber);

        //64位整数
        long longNumber = 123456789;
        System.out.println("longNumber =" + longNumber);

        //一次性声明多个变量
        int number1, number2, number3;
        number1 = 1;
        number2 = 2;
        number3 = 3;
        System.out.println("number1 =" + number1 + ";number2 =" + number2 + ";number3 =" + number3);

        //单精度浮点型
        float secondNumber = 10.2f;
        System.out.println("Second Number =" + secondNumber);

        //双精度浮点型
        double thirdNumber = 10.2d;
        System.out.println("Third Number =" + thirdNumber);

        //字符型
        char ch = 'a';
        System.out.println("Char ch= " + ch);

        //布尔型
        boolean is_ok = false;
        System.out.println("is_ok= " + is_ok);
    }
}
